package com.demo.springTask;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTasks {
    @Scheduled(fixedRate = 2000) // 每隔2秒执行一次
    public void task() {
        System.out.println("定时任务执行：" + System.currentTimeMillis());
    }
}
